#!/usr/bin/env python
# coding: utf-8

# In[11]:


import cv2
from matplotlib import pyplot as plt


# In[12]:


im1=cv2.imread(r"C:\Users\yun\Desktop\test\1.jpg", 0)
im2=cv2.imread(r"C:\Users\yun\Desktop\test\2.jpg", 0)


# In[13]:


orb=cv2.ORB_create()
keypoints1, dest1 = orb.detectAndCompute(im1, None)
keypoints2, dest2 = orb.detectAndCompute(im2, None)
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck = False)


# In[14]:


matches = bf.match(dest1, dest2)


# In[15]:


matches = sorted(matches, key = lambda x: x.distance)


# In[16]:


im3=cv2.drawMatches(im1, keypoints1, im2, keypoints2, matches[:30], None, flags=2)


# In[22]:



plt.imshow(im3)
plt.show()


# In[ ]:




